package com.cjj.mvpsample.presenter;

import com.cjj.mvpsample.model.Bean.User;
import com.cjj.mvpsample.model.BeanBizImp.UserBizImp;
import com.cjj.mvpsample.model.IBeanBiz.IUserBiz;
import com.cjj.mvpsample.view.iview.IUserView;

/**
 * 用户信息处理器
 * MVP中的P
 * @Author：Created by cjj on 16/8/9.
 * @Blog：jianjunchen.net
 */
public class UserPresenter extends BasePresenter<IUserView>{

    private IUserBiz biz = new UserBizImp();

    /**
     * 设置用户信息
     */
    public void setData(){
        biz.setUser();
    }

    /**
     * 获取用户信息并展示
     */
    public void showUserInfo() {
        try {
            User user = biz.getUser();
            String msg = "我是" + user.getUserName() + "我今年" + user.getAge() + "岁，我是个" + user.getSex() + "孩子";
            getView().showUserInfo(msg);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

}
